package com.imooc.miaosha.config;

import java.util.List;

import com.imooc.miaosha.access.AccessInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 配置处理器 配置类
 */
@Configuration
public class WebConfig  extends WebMvcConfigurerAdapter{

	@Autowired
    UserArgumentResolver_OLD userArgumentResolver;
	//@Autowired
	//UserArgumentResolver1 userArgumentResolver1;

	@Override
	public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
		argumentResolvers.add(userArgumentResolver);//添加个自定义的 参数 解析器
	    //argumentResolvers.add(userArgumentResolver1);//添加个自定义的 参数 解析器
	}
	@Autowired
	AccessInterceptor accessInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(accessInterceptor);
	}
	
}
